<template>
	<view>
		<u-mask :show="showMask" @click="show = false">
			<view style="height: 100%;">
				<view class="rect" @tap.stop style="height: 100%;" >
					<view style="background-color: white;height: 100%;" >
						<view style="padding: 20rpx 30rpx;">
							<u-checkbox-group :label-disabled="false" @change="checkboxGroupChange">
								<u-checkbox  v-model="item.checked" 
									v-for="(item, index) in list" :key="index"
									:name="item.charge_id">{{item.charge_name}}</u-checkbox>
							</u-checkbox-group>
						</view>
						<view style="padding: 30rpx;">
							<u-button type="primary"  @click="select">保存</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-mask>
		<u-toast ref="uToast"></u-toast>
		<myModal ref="myModal"></myModal>
	</view>
</template>

<script>
	export default {
		name: "selectOrderCharge",
		data() {
			return {
				form:null,
				keyword: '',
				showMask: false,
				list: [],
				orderChargeIdList:[]
			};
		},
		mounted() {
			this.getChargeList();
		},
		methods: {
			select() {
				this.$emit('select', this.orderChargeIdList);
				this.showMask = false;
			},
			show() {
				this.showMask = true
			},
			checkboxGroupChange(e){
				this.orderChargeIdList=e;
			},
			getChargeList() {
				var that = this;
				that.$http.post('/orderCharge/ListByEntity', {}, (res) => {
					if (res.data.success) {
						that.list = res.data.result.list;
					} else {
						that.refs.myModal.show('请求失败', res.data.result.message);
					}
				});
			},

		}
	}
</script>

<style>

</style>